package com.dfbz.demo02_InputStream;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Arrays;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo05_循环使用字节数组读取 {
    public static void main(String[] args) throws Exception {

        InputStream is = new FileInputStream("001.txt");


        byte[] data = new byte[2];

        int len;

        while ((len = is.read(data)) != -1) {
            System.out.println(new String(data,0,len) + "------有效字节个数: " + len);
        }


        is.close();

    }
}
